package com.linewell.license.demo.bean;

import com.linewell.license.demo.model.User;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * @author
 * Company:
 * Createtime : 2019-07-16 22:09
 * Description :
 */
public class UserDetail implements org.springframework.security.core.userdetails.UserDetails {

    private User user;
    /**
     * 用户账户
     */
    private String username;
    /**
     * 密码
     */
    private String password;

    /**
     * * 权限信息
     */
    private Collection<? extends GrantedAuthority> authorities;

    public void setPassword(String password) {
        this.password = password;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setAuthorities(Collection<? extends GrantedAuthority> authorities) {
        this.authorities = authorities;
    }

    /**
     * * 权限信息
     */
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }
    /**
     * * 用户密码
     */
    @Override
    public String getPassword() {
        return this.password;
    }
    /**
     * * 用户账号
     */
    @Override
    public String getUsername() {
        return this.username;
    }
    /**
     * *帐户是否过期
     */
    @Override
    public boolean isAccountNonExpired() {
        return false;
    }
    /**
     * *帐户是否被冻结
     */
    @Override
    public boolean isAccountNonLocked() {
        return false;
    }
    /**
     **  帐户密码是否过期，一般有的密码要求性高的系统会使用到，比较每隔一段时间就要求用户重置密码
     */
    @Override
    public boolean isCredentialsNonExpired() {
        return false;
    }
    /**
     ** 帐号是否可用
     */
    @Override
    public boolean isEnabled() {
        return false;
    }

}
